<%@ page contentType="text/html;charset=UTF-8" language="java" trimDirectiveWhitespaces="true" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <meta name="format-detection" content="email=no">
    <title>荩美国际商城</title>
    <link href="/resources/frontcss/Hui.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="/resources/frontcss/aui/aui.css" />
    <script src="/resources/js/jquery-1.8.1.min.js" type="text/javascript"></script>
    <style>
        .top-cot{ width:100%; height:2.2rem; line-height:2.2rem; background:#28163d; color:#fff; text-align:center; font-size:16px;}
    </style>
</head>
<body style="background-color: #fff;overflow-x:hidden;">
<div class="top-cot">我的提现申请</div>
<div id="wft_ctn"></div>

    <script type="text/html" id="listTemplate">
        {{# $.each(d, function(i,data) { }}

        <div class="H-theme-background-color-white H-flex-item H-padding-horizontal-both-10 H-font-size-14 H-padding-vertical-both-8">
        <span> 审核状态:
                {{# if(data.status=="0"){}}
                  待审核
                {{#  }}}
                {{# if(data.status=="1"){}}
                 审核通过
                {{#  }}}
                {{# if(data.status=="2"){}}
                审核拒绝
                {{#  }}}
        </span>
        </div>

        <div class="H-theme-background-color-white H-flex-item H-padding-horizontal-both-10 H-font-size-14 H-padding-vertical-both-8">
        <span>  提现金额：{{data.amount}}
        </span>
        </div>

        <div class="H-theme-background-color-white H-flex-item H-padding-horizontal-both-10 H-font-size-14 H-padding-vertical-both-8">
        <span> 提现方式：
                {{# if(data.type=="1"){}}
                 微信提现
                {{#  }}}
                {{# if(data.type=="2"){}}
                银行卡提现
                {{#  }}}
        </span>
        </div>

        <div class="H-theme-background-color-white H-flex-item H-padding-horizontal-both-10 H-font-size-14 H-padding-vertical-both-8">
        <span>    申请时间：{{data.dateStr}}
                {{# if(data.status=="0"){}}
                  <span style="float:right;color:red;"><a href="javascript:void(0);" onclick="cancel('{{data.id}}')">取消申请</a></span>
                {{#  }}}
        </span>
        </div>
        {{#  }) }}

    </script>

<script type="text/javascript" src="/resources/js/laytpl.js"></script>
<script type="text/javascript">
    var _pageFlag = false;
    if(parseInt('${query.pageNo}') < parseInt('${query.pageCount}')) {
        _pageFlag = true; //有下一页
    }
    var params = {
        pageNo: 1,
        pageSize:20
    }
    function loadData(){
        $.ajax({
            url:"/front/user/amount/listTxData?r="+Math.random(),
            data:params,dataType:'json', type:'post',
            success:function(data){
                if(data.success) {
                    var typl = $("#listTemplate").html();
                    if(data.data.data.length==0){
                        if(data.data.pageNo==1){
                            $("#wft_ctn").append("<p  class=\"aui-padded-10\" style=\"font-size: 16px;color: #666;text-align: center\">暂时没有提现记录</p>");
                        }else{
                            $("#wft_ctn").append("<p  class=\"aui-padded-10\" style=\"font-size: 16px;color: #666;text-align: center\">没有更多数据了...</p>");
                        }
                    }else{
                        laytpl(typl).render(data.data.data, function(html) {
                            $("#wft_ctn").append(html);
                        });
                    }
                    $(".loading").addClass("loader-chanage")
                    $(".loading").fadeOut(300);
                    if (data.data.pageNo < data.data.pageTotal) {
                        _pageFlag = true;
                    }
                }
            }
        });
    }

    $(window).scroll(function () {
        if (_pageFlag) {
            if ($(document).scrollTop() >= $(document).height() - $(window).height()) {
                _pageFlag = false;
                params['pageNo'] = params['pageNo'] + 1;
                loadData();
            }
        }
    })
    loadData();
    function cancel(id){
        if(confirm("确定取消该提现申请吗？")){
            $.ajax({
                url:"/front/user/amount/cancelTxApply?r="+Math.random(),
                type:"post",
                data:{
                    id:id
                },
                success:function(res){
                    alert(res.msg);
                    if(res.success){
                        params['pageNo'] =  1;
                        loadData();
                    }
                }
            })
        }

    }
</script>
</body>
</html>